<?
define('_VIEW_MODEL_','default');
require_once './init.php';
header("Content-type:text/vnd.wap.wml;charset=utf-8");
$id=intval($id);
$stip ="";
if(isset($act)&&$act=="exitphnoe"){
	$usrid = intval($id);
	//echo "select `phone` from {$telper}user where id='$usrid'";
	$rs = $db->GetRow("select `phone` from {$telper}user where id='$usrid'");
	if($rs['phone'] == $oldmobile){
		if(preg_match("/^[0-9]*$/",$mobile1)&&strlen($mobile1)==11){
			if(!empty($mobile1)&&$mobile1 == $mobile2){
				$db->Execute("update {$telper}user set `phone`='$mobile1' where id='$usrid'");
				header("Location:bookhouse.php?id=$usrid");
			 	exit;
			}else{
			 header("Location:editphone.php?id=$usrid&wrong=new");
			 exit;	
			}
		}else{
			header("Location:editphone.php?id=$usrid&wrong=num");
			 exit;	
		}
	}else{
		header("Location:editphone.php?id=$usrid&wrong=old");
		exit;
	}
}
if(isset($wrong)&&$wrong=="new"){
	$stip = "两次输入不一致";
}
if(isset($wrong)&&$wrong=="old"){
	$stip = "旧手机号码输入错误";
}
if(isset($wrong)&&$wrong=="num"){
	$stip = "新手机格式错误";
}
$smartyObj->assign("userid",$id);
$smartyObj->assign("stip",$stip);
$smartyObj->display("editphone.tpl");
?>